home *** CD-ROM | disk | FTP | other *** search
/ Freelog 121 / FreelogMagazineJuilletAout2014-No121.iso / Outils / Adobe-Air / adobe-air_13.exe / [0] / setup.swf / scripts / mx / containers / Box.as < prev    next >
Text File  |  2014-03-27  |  3KB  |  88 lines

  1. package mx.containers
  2. {
  3.    import flash.events.Event;
  4.    import mx.containers.utilityClasses.BoxLayout;
  5.    import mx.core.Container;
  6.    import mx.core.IUIComponent;
  7.    import mx.core.mx_internal;
  8.    
  9.    use namespace mx_internal;
  10.    
  11.    public class Box extends Container
  12.    {
  13.       
  14.       mx_internal static const VERSION:String = "3.0.0.0";
  15.        
  16.       
  17.       mx_internal var layoutObject:BoxLayout;
  18.       
  19.       public function Box()
  20.       {
  21.          layoutObject = new BoxLayout();
  22.          super();
  23.          mx_internal::layoutObject.target = this;
  24.       }
  25.       
  26.       mx_internal function isVertical() : Boolean
  27.       {
  28.          return direction != BoxDirection.HORIZONTAL;
  29.       }
  30.       
  31.       public function set direction(param1:String) : void
  32.       {
  33.          mx_internal::layoutObject.direction = param1;
  34.          invalidateSize();
  35.          invalidateDisplayList();
  36.          dispatchEvent(new Event("directionChanged"));
  37.       }
  38.       
  39.       override protected function updateDisplayList(param1:Number, param2:Number) : void
  40.       {
  41.          super.updateDisplayList(param1,param2);
  42.          mx_internal::layoutObject.updateDisplayList(param1,param2);
  43.       }
  44.       
  45.       public function pixelsToPercent(param1:Number) : Number
  46.       {
  47.          var _loc8_:IUIComponent = null;
  48.          var _loc9_:Number = NaN;
  49.          var _loc10_:Number = NaN;
  50.          var _loc2_:Boolean = isVertical();
  51.          var _loc3_:Number = 0;
  52.          var _loc4_:Number = 0;
  53.          var _loc5_:int = numChildren;
  54.          var _loc6_:int = 0;
  55.          while(_loc6_ < _loc5_)
  56.          {
  57.             _loc8_ = IUIComponent(getChildAt(_loc6_));
  58.             _loc9_ = !!_loc2_ ? Number(_loc8_.height) : Number(_loc8_.width);
  59.             _loc10_ = !!_loc2_ ? Number(_loc8_.percentHeight) : Number(_loc8_.percentWidth);
  60.             if(!isNaN(_loc10_))
  61.             {
  62.                _loc3_ += _loc10_;
  63.                _loc4_ += _loc9_;
  64.             }
  65.             _loc6_++;
  66.          }
  67.          var _loc7_:Number = 100;
  68.          if(_loc4_ != param1)
  69.          {
  70.             _loc7_ = _loc4_ * _loc3_ / (_loc4_ - param1) - _loc3_;
  71.          }
  72.          return _loc7_;
  73.       }
  74.       
  75.       override protected function measure() : void
  76.       {
  77.          super.measure();
  78.          mx_internal::layoutObject.measure();
  79.       }
  80.       
  81.       [Bindable("directionChanged")]
  82.       public function get direction() : String
  83.       {
  84.          return mx_internal::layoutObject.direction;
  85.       }
  86.    }
  87. }
  88.